package com.xmy.cultivate.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xmy.cultivate.entity.EnrollRemindDay;
import com.xmy.cultivate.service.IEnrollRemindDayService;
import com.xmy.cultivate.util.Code;
import com.xmy.cultivate.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 邀约提醒间隔时间 前端控制器
 * </p>
 *
 * @author hpiggy
 * @since 2024-08-22
 */
@RestController
@RequestMapping("/api/enrollRemindDay")
public class EnrollRemindDayController {

    @Autowired
    IEnrollRemindDayService iEnrollRemindDayService;

    @GetMapping()
    public Result getEnrollInfoList() {
        EnrollRemindDay enrollRemindDay = iEnrollRemindDayService.getOne(new QueryWrapper<EnrollRemindDay>().last("LIMIT 1"));
        return new Result(Code.OK, enrollRemindDay, Code.OK_MSG);
    }

    @PostMapping()
    public Result getEnrollInfoList(@RequestBody EnrollRemindDay enrollRemindDay) {
        iEnrollRemindDayService.saveOrUpdate(enrollRemindDay);
        return new Result(Code.OK, "", Code.OK_MSG);
    }

}
